<template>
  <div>
    <dongle :value="num" @input="fn"></dongle>
    <!-- v-model 双向绑定 也已用于数组,但 必须是value接收数据 ,触发必须是input事件 -->
    <dongle v-model="num"></dongle>
    <dongle ref="zz" v-model="num"></dongle>
    <button @click="zujian">点击获取组件信息</button>
  </div>
</template>

<script>
import dongle from "./components/dongle.vue";
export default {
  components: { dongle },
  data() {
    return {
      num: 2,
    };
  },
  methods: {
    fn(val) {
      this.num = val;
    },
    zujian() {
      console.log(this.$refs.zz.msg);
      this.$refs.zz.fn2()
    },
  },
};
</script>

<style>
</style>